package com.day0927.Rental_cars;

public class Car extends Vehicle {
    private String c_type;//汽车型号

    public Car(String c_type) {
        this.c_type = c_type;
    }

    public Car(String v_brand_name, String v_number, int day_price, String c_type) {
        super(v_brand_name, v_number, day_price);
        this.c_type = c_type;
    }

    public String getC_type() {
        return c_type;
    }

    public void setC_type(String c_type) {
        this.c_type = c_type;
    }

    @Override
    public double totalPrice(int day) {
        double c_discount = cDiscount(day);
        return (day_price * day) * c_discount;
        //return super.totalPrice(day);
    }

    public double cDiscount(int day){
        if (day > 150){
            return 0.7;
        }
        else if (day > 30){
            return 0.8;
        }
        else if (day > 7){
            return 0.9;
        }
        return 1;
    }

    public void show(){
        System.out.println(this.getV_brand_name());
        System.out.println(this.getV_number());
        System.out.println(this.getDay_price());
        System.out.println(this.getC_type());

    }
}
